puzzle one's wits

(为某事)绞尽脑汁,苦思冥想